package com.riant.day04.demo1;

import java.util.concurrent.Callable;

/**
 * @Classname MyCallable
 * @Description TODO
 * @Date 2021/3/10 15:10
 * @Created by 张斌
 */
public class MyCallable implements Callable<Integer> {
    @Override
    public Integer call() throws Exception {
        System.out.println("执行Callable方法");
        Thread.sleep(100);
        for(int i=0;i<=10;i++){
            System.out.println("当前Callable线程名："+Thread.currentThread().getName() +",i="+i);
        }
        int sum=0;
        for (int i = 0; i <= 10; i++) {
            sum+=i;
        }
        return sum;
    }
}
